package top.yi2911.lifeUtils

import android.view.View
import androidx.recyclerview.widget.GridLayoutManager
import top.yi2911.lifeUtils.adapter.MainRecycleAdapter
import top.yi2911.lifeUtils.adapter.OnItemClickListener
import top.yi2911.lifeUtils.databinding.ActivityMainBinding
import top.yi2911.lifeUtils.model.Features
import top.yi2911.lj_camerax.LJCamera

class MainActivity : BaseActivity<ActivityMainBinding>() {
    lateinit var adapter: MainRecycleAdapter
    override fun initView() {
        thisBinding.mainRecycleList.layoutManager = GridLayoutManager(this, 3)
    }

    override fun initData() {
        val features = arrayOf(Features(R.mipmap.id_card, "身份证识别"))
        adapter = MainRecycleAdapter(features, R.layout.activity_main_item)
        thisBinding.mainRecycleList.adapter = adapter

        adapter.setOnItemClickListener(object : OnItemClickListener {
            override fun onItemClick(view: View, position: Int) {
                when (position) {
                    0 -> {
                        LJCamera().setContext(this@MainActivity).goFeature()
                    }
                }
            }

            override fun onItemLongClick(view: View, position: Int) {
            }

        })
    }
}